package top.csjss.service.impl;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.csjss.domain.Workorder;
import top.csjss.mapper.WorkorderMapper;
import top.csjss.service.WorkorderService;

/**
 * @Author ztf
 * @Date 14:17 2021/10/7
 **/
@Service
public class WorkorderServiceImpl implements WorkorderService {
    @Autowired
    private WorkorderMapper workorderMapper;

    @Transactional(rollbackFor = RuntimeException.class)
    @Override
    public void insert(Workorder workorder) {
        int i= workorderMapper.insert(workorder);
        if (i!=1){
            System.out.println("工单添加失败");
            throw new RuntimeException("工单添加失败");
        }
    }
}
